package com.example.demo.pattern.single;

/**
 * @author wangadmin
 */
public class SingleByEnum {


    private SingleByEnum() {

    }


    public static SingleByEnum getInstance() {
        return Singleton.INSTANCE.getInstance();
    }

    private enum Singleton {//内部枚举类
        INSTANCE;

        private SingleByEnum instance;


        Singleton() {
            instance = new SingleByEnum();
        }

        public SingleByEnum getInstance() {
            return instance;
        }
    }
}
